# split rsplit splitlines partition rpartition

s1 = 'qwe,asd,zxc,vbn,fgh,rty'
s2 = s1.split(',')  # list : ['qwe', 'asd', 'zxc', 'vbn', 'fgh', 'rty']
s3 = s1.rsplit(',')
print(s1)
print(s2)
print(s3)
s2 = s1.split(',', 2)  # 从左向右----->
s3 = s1.rsplit(',', 2)  # 从有向左<-----
print(s2)
print(s3)

print('------------------------')

# partition
"""
        Partition the string into three parts using the given separator.

        This will search for the separator in the string.  If the separator is found,
        returns a 3-tuple containing the part before the separator, the separator
        itself, and the part after it.

        If the separator is not found, returns a 3-tuple containing the original string
        and two empty strings.
        """
# 前面 分隔符 后面
print('asdAdsazxczxczxcAdsadasd'.partition('Ad'))  # 从左向右----->
print('asdAdsazxczxczxcAdsadasd'.rpartition('Ad'))  # 从有向左<-----
# 应用：获取文件名，后缀名
print('2020.1.1.电影.mp4'.rpartition('.'))

# 拼接 join
name = ['qwe', 'asd', 'zxc', 'vbn', 'fgh', 'rty']
s = '-'.join(name)
print(s)
print('**'.join('hasd'))
# str.join(iterable) join中是可迭代对象
